<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>controller</title>
</head>
<body>
<script>
<%
var fs = require('fs'),
	mime = request.util.mime,
	action = request.data.action,
	result;
response.writeHead(200, {"Content-Type": mime.get('json') });	
return function(){
	switch(action){
		case 'config':
			result = fs.readFileSync( request.util.conf.root+request.$.title.replace(/[^\\\/]+$/,'config.json') );
			response.end( JSON.stringify( eval('('+result+')') ) );
			break;
		/* 上传图片 */
	    case 'uploadimage':
	    /* 上传涂鸦 */
	    case 'uploadscrawl':
	    /* 上传视频 */
	    case 'uploadvideo':
	    /* 上传文件 */
	    case 'uploadfile':
	    	var f = request.files[0].file;
        	response.end( '{"original":"'+f.name+'","name":"'+f.name+'","url":"http://staticconf:2850/static/'+f.name+'","size":"'+f.size+'","type":"'+f.type+'","state":"SUCCESS"}' )
        	break;
	}
};
%>	
</script>	
</body>
</html>

